layui.use(['form', 'layer', 'laydate', 'table', 'laytpl'], function() {
				var form = layui.form,
					layer = parent.layer === undefined ? layui.layer : top.layer,
					$ = layui.jquery,
					laydate = layui.laydate,
					laytpl = layui.laytpl,
					table = layui.table,
					laypage = layui.laypage;
					//$("#shili").show();
					$("#user_name").val(localStorage.login_name);
				var selectwangwang 	= "";
				var good_wangwang	= "";
				
				//获取银行卡判断银行所属银行
				$(".count_bank_num").blur(function(){
					var card = $(".count_bank_num").val();
					$.ajax({
						type:"get",
						url:"https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?cardNo="+card+"&cardBinCheck=true",
						dataType:"json",
						success:function(data){
							console.log(data);
							if(data.messages.length){
								layer.msg("您输入的卡号有误，请重新输入");
								$(".count_bank_num").focus();
							}else{
								var bank = data.bank;
								$.ajax({
									type:"get",
									url:"/json/bank.json",
									datatype:"json",
									success:function(obj){
										$(".count_bank_name").val(obj[bank]);
									}
								});
							}
							
						}
					});
				});
				
				//判断用户选择的账户类型=》支付宝|网银
				form.on('radio',function(data){
					console.log(data.value);
					if (data.value==="支付宝") {
						$(".zhifubao").show();
						form.verify({
							count_Alipay_num:function(value){
								if(!value){
									return "支付宝账号不能为空";
								}
							},
							count_Alipay_nickname:function(value){
								if(!value){
									return "支付宝昵称不能为空";
								}
							}
						})
						$(".wangyin").hide();
					} else{
						$(".wangyin").show();
						form.verify({
							
							count_bank_num:function(value){
								if(!value){
									return "请输入银行卡账号";
								}
							},
							count_bank_name:function(value){
								if(!value){
									return "未获取到您的银行卡信息";
								}
							}
						})
						$(".zhifubao").hide();
					}
				});
				form.on("submit(addcount)",function(data){
			        //弹出loading
			        //alert($("#file").val());
			        var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
			        var action 	= data.form.action;//表单提交URL地址
			        //var da		= data.field;
			        console.log($(".count_type").val());
			        $.post("http://127.0.0.1:88/index.php/count/count/addCount",data.field,function(obj){
			        	if(obj.code==500){
			        		setTimeout(function(){
				        		layer.msg(obj.msg);
				        	},2000);
			        	}else{
				        	setTimeout(function(){
				        		layer.msg(obj.msg);
				        		top.layer.close(index);
						        //top.layer.msg("商铺添加成功！");
						        layer.closeAll("iframe");
						        //刷新父页面
						        parent.location.reload();
				        		
				        	},2000);
			        	}
			        });
			      /*  setTimeout(function(){
			            top.layer.close(index);
			            //top.layer.msg("商铺添加成功！");
			            layer.closeAll("iframe");
			            //刷新父页面
			            parent.location.reload();
			        },2000);*/
			        return false;
			    })
				
			})
			